import 'package:flutter/material.dart';
import 'package:flutter_demo/placeholder_widget/BigPic.dart';
import 'package:flutter_demo/placeholder_widget/ListPage.dart';
import 'package:flutter_demo/placeholder_widget/Setting.dart';
import 'package:flutter_demo/route/RouteWrapper.dart';
import 'DefaultTabController_Widget.dart';

class CustomPicBottomTab_Widget extends StatefulWidget {
  const CustomPicBottomTab_Widget({Key? key}) : super(key: key);

  @override
  _StartWidgetState createState() => _StartWidgetState();
}

class _StartWidgetState extends State<CustomPicBottomTab_Widget> {
  int _currentIndex = 0;
  List<Widget> _list_widget = [
    ListPage(),
    BigPic(),
    DefaultTabController_Widget(),
    DefaultTabController_Widget(),
    Setting()
  ];

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        theme: ThemeData(
          //可以去除按钮点击的水波纹效果
          brightness: Brightness.light,
          splashColor: Colors.transparent,
          highlightColor: Colors.transparent,
        ),
        // 当页面跳转时进行参数处理
        onGenerateRoute:onGenerateRoute,
        home: Scaffold(
          appBar: AppBar(
            title: Text("BottomTab"),
            backgroundColor: Colors.black45,
          ),
          floatingActionButton: Container(
            height: 60,
            width: 60,
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(50),
            ),
            margin: EdgeInsets.only(top: 35),
            child: FloatingActionButton(onPressed: () {
              print("发布按钮被点击");
            },
              highlightElevation:0,//去除按压的水波纹效果
              child:Image.asset("images/fabu.png",width: 50,height: 50,),
              backgroundColor:Colors.white,
              elevation:0,
            ),
          ),
          floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
          body: _list_widget[_currentIndex],
          bottomNavigationBar: BottomNavigationBar(
            type: BottomNavigationBarType.fixed,
            onTap: (index) {
              print(index);
              setState(() {
                _currentIndex = index;
              });
            },
            backgroundColor: Colors.white,
            selectedFontSize: 12,
            unselectedFontSize: 12,
            currentIndex: _currentIndex,
            unselectedLabelStyle: TextStyle(
              fontSize: 12,
              color: Color(int.parse("0xff383640")), //加载自定义颜色的方式
            ),
            selectedItemColor: Color(int.parse("0xff0CB65B")),
            items: <BottomNavigationBarItem>[
              BottomNavigationBarItem(
                  icon: Image.asset(
                    "images/main_square_icon.png",
                    width: 24,
                    height: 24,
                  ),
                  tooltip: "", //去除长按震动效果
                  activeIcon: Image.asset(
                    "images/main_square_tab_default.png",
                    width: 24,
                    height: 24,
                  ),
                  label: "广场"),
              BottomNavigationBarItem(
                  icon: Image.asset(
                    "images/main_course_icon.png",
                    width: 24,
                    height: 24,
                  ),
                  activeIcon: Image.asset(
                    "images/kecheng.png",
                    width: 24,
                    height: 24,
                  ),
                  label: "课程"),
              BottomNavigationBarItem(
                  icon: Image.asset(
                    "images/fabu.png",
                    width: 24,
                    height: 24,
                  ),
                  tooltip: "", //去除长按震动效果
                  label: ""),
              BottomNavigationBarItem(
                  icon: Image.asset(
                    "images/huodong_un_selected.png",
                    width: 24,
                    height: 24,
                  ),
                  activeIcon: Image.asset(
                    "images/huodong_selected.png",
                    width: 24,
                    height: 24,
                  ),
                  label: "活动"),
              BottomNavigationBarItem(
                  icon: Image.asset(
                    "images/mine_un_selected.png",
                    width: 24,
                    height: 24,
                  ),
                  activeIcon: Image.asset(
                    "images/mine_selected.png",
                    width: 24,
                    height: 24,
                  ),
                  label: "我的"),
            ],
          ),
        ));


  }
}
